import 'dart:ui';

class SizeFit {
  // 1.基本信息
  static double physicalWidth=window.physicalSize.width;
  static double physicalHeight = window.physicalSize.height;
  static double screenWidth = physicalWidth / dpr;
  static double screenHeight = physicalHeight / dpr;
  static double dpr = window.devicePixelRatio;
  static double statusHeight = window.padding.top / dpr;
  static double standardSize = 750;
  static double rpx = screenWidth / standardSize;
  static double px = screenWidth / standardSize * 2;

  static void initialize({double standardSize = 750}) {
    // 1.手机的物理分辨率
    // physicalWidth = window.physicalSize.width;
    // physicalHeight = window.physicalSize.height;

    // // 2.获取dpr
    // dpr = window.devicePixelRatio;

    // // 3.宽度和高度
    // screenWidth = physicalWidth / dpr;
    // screenHeight = physicalHeight / dpr;

    // // 4.状态栏高度
    // statusHeight = window.padding.top / dpr;

    // 5.计算rpx的大小
    rpx = screenWidth / standardSize;
    px = screenWidth / standardSize * 2;
  }

  static double setRpx(double size) {
    return rpx * size;
  }

  static double setPx(double size) {
    return px * size;
  }
}